const _products = [
  {"id": 1, "title": "iPad 4 MINI", "price": 500, "inventory": 3},
  {"id": 2, "title": "HUAWEI P8 Plus", "price": 2500, "inventory": 13},
  {"id": 3, "title": "xiaoMi 11plus", "price": 3500, "inventory": 7},
  {"id": 4, "title": "ViVo red 美颜神器", "price": 1500, "inventory": 3},
]

export  const getAllProducts = (cb)=>{
  setTimeout(()=>{
    cb(_products);
  },500)
};

export const buyProduct = (products,cb, errCb ) =>{
  setTimeout(()=>{
    Math.random()>0.3? cb():errCb()
  },100)
}